package com.itheima.Test;

public class AAATest002 implements Runnable {
    int a = 100;

    @Override
    public void run() {

            while (true) {
                synchronized ("锁") {
                if (a <= 0) {
                    break;
                }
                System.out.println(Thread.currentThread().getName() + "售出了" + a + "号票");
                a--;
            }
        }

    }
}
